/*******************************************************************************
 * Copyright (c) 2010, 2030 www.itlaobing.cn
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package cn.itlaobing.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import cn.itlaobing.model.OrderModel;



/** 
 * ClassName: OrderDao <br/> 
 * Function: 订单dao层 <br/> 
 * date: 2017年11月1日 下午2:35:12 <br/> 
 * 
 * @author wd
 * @version  
 * @since JDK 1.8 
 */
public class OrderDao extends BaseDao<OrderModel> {
	
	public List<OrderModel>queryAll()throws SQLException,ClassNotFoundException{
		String sql="select * from orders";
		List<OrderModel>list=new ArrayList<OrderModel>();
		ResultSet rs= dbhelper.executeQuery(sql);
		
		while(rs.next()) {
			OrderModel om=new OrderModel();
			om.setId(rs.getInt(1));
			om.setOrderId(rs.getString(2));
			om.setBuyTime(rs.getString(3));
			om.setUserId(rs.getInt(4));
			om.setTotalMoney(rs.getDouble(5));
			om.setOrderStatus(rs.getInt(6));
			om.setOrderFrom(rs.getInt(7));
			om.setReceiveName(rs.getString(8));
			om.setReceivePhone(rs.getString(9));
			om.setAddress(rs.getString(10));
			list.add(om);
		}
		return list;
	}
	
	
}
